
package chapter1;

public class Ex1 {
    public static void main(String[] args) {
        int n = 100;
        double[] array = new double[n];
        for (int i = 0; i < n; i++) {
            array[i] = Math.random();
        }
        double mean = 0.0;
        double stddev = 0.0;
        for (int i = 0; i < n; i++) {
            mean += array[i];
            stddev += array[i] * array[i];
        }
        mean /= n;
        stddev = Math.sqrt(stddev/n - mean * mean);
        System.out.println("Mean = " + mean);
        System.out.println("Standard deviation = " + stddev);
    }   
}
